<?php

namespace App\Jobs;

use App\Jobs\Job;
use App\Services\Wechat\Pay;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

class RunPay extends Job implements ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    protected $carts, $uid, $sn, $payby;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($carts, $uid, $sn, $payby)
    {
        $this->carts = $carts;
        $this->uid = $uid;
        $this->sn = $sn;
        $this->payby = $payby;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(Pay $pay)
    {
        return $pay->runpay($this->carts, $this->uid, $this->sn, $this->payby);
    }
}
